
import axios from 'axios';
import { reactive, onMounted } from 'vue';


export default function() {
    const dogList = reactive([])
    const getImage = async () => {
        const result = await axios.get('https://dog.ceo/api/breeds/image/random')
        console.log(result);
        if (result.data.status === 'success') {
            dogList.push(result.data.message);
        } else {
            console.error('Failed to fetch image');
        }
    }


    onMounted(()=>{
        getImage()
    })

    return {
        dogList,
        getImage
    }
}